package com.bw.cinema.repo

import com.bw.cinema.ApiService
import com.bw.cinema.entity.MutilTypeEntity
import com.bw.cinema.entity.MutilVideoEntity
import com.bw.lib_miv.BaseRepo
import com.bw.lib_net.BaseRes
import com.bw.lib_net.RetrofitManager
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class CinemaRepo @Inject constructor() : BaseRepo() {
    val api = RetrofitManager.getRetrofit().create(ApiService::class.java)

    //获取数据类型
    fun getMutilType(): Flow<BaseRes<List<MutilTypeEntity>>> = api.getMutilType()

    //获取二级数据类型
    fun getSubMutilType(id: Int): Flow<BaseRes<List<MutilTypeEntity>>> = api.getSubMutilType(id)

    //获取数据
    fun getMutilVideo(page: Int, size: Int, id: Int): Flow<BaseRes<List<MutilVideoEntity>>> =
        api.getMutilVideo(page, size, id)


    //猜您喜欢
    fun getRecommendMutilVideo(page: Int, size: Int): Flow<BaseRes<List<MutilVideoEntity>>> =
        api.getRecommendMutilVideo(page, size)


    var mutilvideoEntity: MutilVideoEntity? = null

    fun getMutilVideo() = mutilvideoEntity

    fun setMutilVideo(entity: MutilVideoEntity) {
        mutilvideoEntity = entity
    }
}